<?php 
require_once('scripts/restrict_access.php');
if ($identity->accessLevel>10){
	header('Location: AccessDenied.php');
	exit;
}
require_once('scripts/library.php');
require_once('scripts/processEditCatalog.php'); 
?>
 <?php 

			   $sql = 'SELECT * FROM `databases` WHERE `dbID`= ? ORDER BY dbName';
			   $result = $dbRead->fetchAll($sql,$_GET['dbId']);
			   $size_of_result = sizeof($result);
		   
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title      : Complimentary
Version    : 1.0
Released   : 20080409
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Edit Catalog</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="CSS/ComplementaryDefault.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<!-- start header -->
<div id="header">
<div id="logo">
    <h1><a href="#">Find-it</a>
</h1></div>
<div id="menu">
  <ul>
    <li class="active"><a href="DBList.php"> Catalogs</a></li>
    <li><a href="NewUserForm.php">New User </a></li>
    <li><a href="Index.php?logout">Logout </a></li>
  </ul>
  
</div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page">
  <!-- start content -->
  <div id="content">
    <div class="post">
      <p><br />
      </p>     
      
      <h1 class="title">Edit Catalog</h1>
      
     
      <div class="entry">
        <form name="form1" id="form1" method="POST">
          <span class="warning">
          <?php
		   //$thisDbID = $_GET['dbId'];
           if ($_POST && isset($errors['dbName'])){
			   echo $errors['dbName'];
		   } ?>
          </span>
          <label for="dbName">Catalog Name</label>
          <input value="<?php if ($_POST && $errors){
			  echo htmlentities($_POST['dbName'],ENT_COMPAT, 'UTF-8');
		  } else{
			echo $result[0]['dbName'];
		  }
		  ?>" name="dbName" type="text" id="dbName" size="60" maxlength="150" />
          <br />
          <label for="dbDescription">Description</label>
          <textarea name="dbDescription" id="dbDescription" cols="59" rows="5"><?php if ($_POST && $errors){
   echo htmlentities($_POST['dbDescription'],ENT_COMPAT, 'UTF-8');
    } else {
		echo $result[0]['dbDescription'];}
		?>
          </textarea>
          <br />
          <a href="scripts/process_delete_catalog.php?dbId=<?php echo $result[0]['dbID']; ?>">Delete Catalog</a>
          <input type="reset" name="clearButton" id="clearButton" value="Clear" />
          <input type="submit" name="formButton1" id="formButton1" value="Save" />
          <input name="dbId" type="hidden" value="<?php echo $_GET['dbId'] ?>" />
        </form>
        <!-- The bottomSpace div is for reserving space at the bottom for the footer -->
        <div class="bottomSpace">
          <p><br /><br />
          </p>
        </div>
      </div>
      
    </div>
  </div>
  <!-- end content -->
  <!-- start sidebar --><!-- end sidebar -->
  <div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
  <p id="legal">(c) 2012 Find-It. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br />
	</p>
</div>
<!-- end footer -->
</body>
</html>